package com.foreknow.elmboot.controller;

import com.foreknow.elmboot.po.Business;
import com.foreknow.elmboot.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//http://localhost:8888/springboot_demo/BusinessController/listBusinessByTypeId/
//@Controller 表示当前类是一个控制器
//@RestController SpringBoot中提供的注解，表示调用方法的结果最终以json的格式返回给前台
//@RestController = @Controller + @ResponseBody
//@Controller
@RestController
@RequestMapping("/BusinessController")
public class BusinessController {
    @Autowired
    private BusinessService businessService;

    @RequestMapping("/listBusinessByOrderTypeId ")
    public List<Business> listBusinessByTypeId(Business business){
        return businessService.listBusinessByTypeId(business.getOrderTypeId());
    }

    @RequestMapping("/getBusinessById")
    public Business getBusinessById(Business business){
        return businessService.getBusinessById(business.getBusinessId());
    }
}
